home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / widget.info.z / widget.info
Encoding:
GNU Info File  |  1998-05-21  |  48.5 KB  |  1,548 lines

  1. This is Info file ../info/widget.info, produced by Makeinfo version
  2. 1.68 from the input file widget.texi.
  3.  
  4. 
  5. File: widget.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  6.  
  7. The Emacs Widget Library
  8. ************************
  9.  
  10. * Menu:
  11.  
  12. * Introduction::
  13. * User Interface::
  14. * Programming Example::
  15. * Setting Up the Buffer::
  16. * Basic Types::
  17. * Sexp Types::
  18. * Widget Properties::
  19. * Defining New Widgets::
  20. * Widget Browser::
  21. * Widget Minor Mode::
  22. * Utilities::
  23. * Widget Wishlist::
  24.  
  25. 
  26. File: widget.info,  Node: Introduction,  Next: User Interface,  Prev: Top,  Up: Top
  27.  
  28. Introduction
  29. ============
  30.  
  31.    Most graphical user interface toolkits, such as Motif and XView,
  32. provide a number of standard user interface controls (sometimes known as
  33. `widgets' or `gadgets').  Emacs doesn't really support anything like
  34. this, except for an incredible powerful text "widget".  On the other
  35. hand, Emacs does provide the necessary primitives to implement many
  36. other widgets within a text buffer.  The `widget' package simplifies
  37. this task.
  38.  
  39.    The basic widgets are:
  40.  
  41. `link'
  42.      Areas of text with an associated action.  Intended for hypertext
  43.      links embedded in text.
  44.  
  45. `push-button'
  46.      Like link, but intended for stand-alone buttons.
  47.  
  48. `editable-field'
  49.      An editable text field.  It can be either variable or fixed length.
  50.  
  51. `menu-choice'
  52.      Allows the user to choose one of multiple options from a menu, each
  53.      option is itself a widget.  Only the selected option will be
  54.      visible in the buffer.
  55.  
  56. `radio-button-choice'
  57.      Allows the user to choose one of multiple options by activating
  58.      radio buttons.  The options are implemented as widgets.  All
  59.      options will be visible in the buffer.
  60.  
  61. `item'
  62.      A simple constant widget intended to be used in the `menu-choice'
  63.      and `radio-button-choice' widgets.
  64.  
  65. `choice-item'
  66.      An button item only intended for use in choices.  When invoked,
  67.      the user will be asked to select another option from the choice
  68.      widget.
  69.  
  70. `toggle'
  71.      A simple `on'/`off' switch.
  72.  
  73. `checkbox'
  74.      A checkbox (`[ ]'/`[X]').
  75.  
  76. `editable-list'
  77.      Create an editable list.  The user can insert or delete items in
  78.      the list.  Each list item is itself a widget.
  79.  
  80.    Now of what possible use can support for widgets be in a text editor?
  81. I'm glad you asked.  The answer is that widgets are useful for
  82. implementing forms.  A "form" in emacs is a buffer where the user is
  83. supposed to fill out a number of fields, each of which has a specific
  84. meaning.  The user is not supposed to change or delete any of the text
  85. between the fields.  Examples of forms in Emacs are the `forms' package
  86. (of course), the customize buffers, the mail and news compose modes,
  87. and the HTML form support in the `w3' browser.
  88.  
  89.    The advantages for a programmer of using the `widget' package to
  90. implement forms are:
  91.  
  92.   1. More complex field than just editable text are supported.
  93.  
  94.   2. You can give the user immediate feedback if he enters invalid data
  95.      in a text field, and sometimes prevent entering invalid data.
  96.  
  97.   3. You can have fixed sized fields, thus allowing multiple field to be
  98.      lined up in columns.
  99.  
  100.   4. It is simple to query or set the value of a field.
  101.  
  102.   5. Editing happens in buffer, not in the mini-buffer.
  103.  
  104.   6. Packages using the library get a uniform look, making them easier
  105.      for the user to learn.
  106.  
  107.   7. As support for embedded graphics improve, the widget library will
  108.      extended to support it.  This means that your code using the widget
  109.      library will also use the new graphic features by automatic.
  110.  
  111.    In order to minimize the code that is loaded by users who does not
  112. create any widgets, the code has been split in two files:
  113.  
  114. `widget.el'
  115.      This will declare the user variables, define the function
  116.      `widget-define', and autoload the function `widget-create'.
  117.  
  118. `wid-edit.el'
  119.      Everything else is here, there is no reason to load it explicitly,
  120.      as it will be autoloaded when needed.
  121.  
  122. 
  123. File: widget.info,  Node: User Interface,  Next: Programming Example,  Prev: Introduction,  Up: Top
  124.  
  125. User Interface
  126. ==============
  127.  
  128.    A form consist of read only text for documentation and some fields,
  129. where each the fields contain two parts, as tag and a value.  The tags
  130. are used to identify the fields, so the documentation can refer to the
  131. foo field, meaning the field tagged with `Foo'. Here is an example form:
  132.  
  133.      Here is some documentation.
  134.      
  135.      Name: My Name     *Choose*: This option
  136.      Address:  Some Place
  137.      In some City
  138.      Some country.
  139.      
  140.      See also _other work_ for more information.
  141.      
  142.      Numbers: count to three below
  143.      [INS] [DEL] One
  144.      [INS] [DEL] Eh, two?
  145.      [INS] [DEL] Five!
  146.      [INS]
  147.      
  148.      Select multiple:
  149.      
  150.      [X] This
  151.      [ ] That
  152.      [X] Thus
  153.      
  154.      Select one:
  155.      
  156.      (*) One
  157.      ( ) Another One.
  158.      ( ) A Final One.
  159.      
  160.      [Apply Form] [Reset Form]
  161.  
  162.    The top level widgets in is example are tagged `Name', `Choose',
  163. `Address', `_other work_', `Numbers', `Select multiple', `Select one',
  164. `[Apply Form]', and `[Reset Form]'.  There are basically two thing the
  165. user can do within a form, namely editing the editable text fields and
  166. activating the buttons.
  167.  
  168. Editable Text Fields
  169. --------------------
  170.  
  171.    In the example, the value for the `Name' is most likely displayed in
  172. an editable text field, and so are values for each of the members of
  173. the `Numbers' list.  All the normal Emacs editing operations are
  174. available for editing these fields.  The only restriction is that each
  175. change you make must be contained within a single editable text field.
  176. For example, capitalizing all text from the middle of one field to the
  177. middle of another field is prohibited.
  178.  
  179.    Editing text fields are created by the `editable-field' widget.
  180.  
  181.    The editing text fields are highlighted with the `widget-field-face'
  182. face, making them easy to find.
  183.  
  184.  - Face: widget-field-face
  185.      Face used for other editing fields.
  186.  
  187. Buttons
  188. -------
  189.  
  190.    Some portions of the buffer have an associated "action", which can
  191. be "invoked" by a standard key or mouse command.  These portions are
  192. called "buttons".  The default commands for activating a button are:
  193.  
  194. `<RET>'
  195.       - Command: widget-button-press POS &optional EVENT
  196.           Invoke the button at POS, defaulting to point.  If point is
  197.           not located on a button, invoke the binding in
  198.           `widget-global-map' (by default the global map).
  199.  
  200. `mouse-2'
  201.       - Command: widget-button-click EVENT
  202.           Invoke the button at the location of the mouse pointer.  If
  203.           the mouse pointer is located in an editable text field,
  204.           invoke the binding in `widget-global-map' (by default the
  205.           global map).
  206.  
  207.    There are several different kind of buttons, all of which are
  208. present in the example:
  209.  
  210. *The Option Field Tags.*
  211.      When you invoke one of these buttons, you will be asked to choose
  212.      between a number of different options.  This is how you edit an
  213.      option field.  Option fields are created by the `menu-choice'
  214.      widget.  In the example, `Choose' is an option field tag.
  215.  
  216. *The `[INS]' and `[DEL]' buttons.*
  217.      Activating these will insert or delete elements from a editable
  218.      list.  The list is created by the `editable-list' widget.
  219.  
  220. *Embedded Buttons.*
  221.      The `_other work_' is an example of an embedded button. Embedded
  222.      buttons are not associated with a fields, but can serve any
  223.      purpose, such as implementing hypertext references.  They are
  224.      usually created by the `link' widget.
  225.  
  226. *The `[ ]' and `[X]' buttons.*
  227.      Activating one of these will convert it to the other.  This is
  228.      useful for implementing multiple-choice fields.  You can create it
  229.      wit
  230.  
  231. *The `( )' and `(*)' buttons.*
  232.      Only one radio button in a `radio-button-choice' widget can be
  233.      selected at any time.  When you invoke one of the unselected radio
  234.      buttons, it will be selected and the previous selected radio
  235.      button will become unselected.
  236.  
  237. *The `[Apply Form]' `[Reset Form]' buttons.*
  238.      These are explicit buttons made with the `push-button' widget.
  239.      The main difference from the `link' widget is that the buttons are
  240.      will be displayed as GUI buttons when possible.  enough.
  241.  
  242.    To make them easier to locate, buttons are emphasized in the buffer.
  243.  
  244.  - Face: widget-button-face
  245.      Face used for buttons.
  246.  
  247.  - User Option: widget-mouse-face
  248.      Face used for buttons when the mouse pointer is above it.
  249.  
  250. Navigation
  251. ----------
  252.  
  253.    You can use all the normal Emacs commands to move around in a form
  254. buffer, plus you will have these additional commands:
  255.  
  256. `<TAB>'
  257.       - Command: widget-forward &optional COUNT
  258.           Move point COUNT buttons or editing fields forward.
  259.  
  260. `<M-TAB>'
  261.       - Command: widget-backward &optional COUNT
  262.           Move point COUNT buttons or editing fields backward.
  263.  
  264. 
  265. File: widget.info,  Node: Programming Example,  Next: Setting Up the Buffer,  Prev: User Interface,  Up: Top
  266.  
  267. Programming Example
  268. ===================
  269.  
  270.    Here is the code to implement the user interface example (see *Note
  271. User Interface::).
  272.  
  273.      (require 'widget)
  274.      
  275.      (eval-when-compile
  276.        (require 'wid-edit))
  277.      
  278.      (defvar widget-example-repeat)
  279.      
  280.      (defun widget-example ()
  281.        "Create the widgets from the Widget manual."
  282.        (interactive)
  283.        (kill-buffer (get-buffer-create "*Widget Example*"))
  284.        (switch-to-buffer (get-buffer-create "*Widget Example*"))
  285.        (kill-all-local-variables)
  286.        (make-local-variable 'widget-example-repeat)
  287.        (widget-insert "Here is some documentation.\n\nName: ")
  288.        (widget-create 'editable-field
  289.               :size 13
  290.               "My Name")
  291.        (widget-create 'menu-choice
  292.               :tag "Choose"
  293.               :value "This"
  294.               :help-echo "Choose me, please!"
  295.               :notify (lambda (widget &rest ignore)
  296.                     (message "%s is a good choice!"
  297.                          (widget-value widget)))
  298.               '(item :tag "This option" :value "This")
  299.               '(choice-item "That option")
  300.               '(editable-field :menu-tag "No option" "Thus option"))
  301.        (widget-insert "Address: ")
  302.        (widget-create 'editable-field
  303.               "Some Place\nIn some City\nSome country.")
  304.        (widget-insert "\nSee also ")
  305.        (widget-create 'link
  306.               :notify (lambda (&rest ignore)
  307.                     (widget-value-set widget-example-repeat
  308.                               '("En" "To" "Tre"))
  309.                     (widget-setup))
  310.               "other work")
  311.        (widget-insert " for more information.\n\nNumbers: count to three below\n")
  312.        (setq widget-example-repeat
  313.          (widget-create 'editable-list
  314.                     :entry-format "%i %d %v"
  315.                     :notify (lambda (widget &rest ignore)
  316.                       (let ((old (widget-get widget
  317.                                  ':example-length))
  318.                             (new (length (widget-value widget))))
  319.                         (unless (eq old new)
  320.                           (widget-put widget ':example-length new)
  321.                           (message "You can count to %d." new))))
  322.                     :value '("One" "Eh, two?" "Five!")
  323.                     '(editable-field :value "three")))
  324.        (widget-insert "\n\nSelect multiple:\n\n")
  325.        (widget-create 'checkbox t)
  326.        (widget-insert " This\n")
  327.        (widget-create 'checkbox nil)
  328.        (widget-insert " That\n")
  329.        (widget-create 'checkbox
  330.               :notify (lambda (&rest ignore) (message "Tickle"))
  331.               t)
  332.        (widget-insert " Thus\n\nSelect one:\n\n")
  333.        (widget-create 'radio-button-choice
  334.               :value "One"
  335.               :notify (lambda (widget &rest ignore)
  336.                     (message "You selected %s"
  337.                          (widget-value widget)))
  338.               '(item "One") '(item "Another One.") '(item "A Final One."))
  339.        (widget-insert "\n")
  340.        (widget-create 'push-button
  341.               :notify (lambda (&rest ignore)
  342.                     (if (= (length (widget-value widget-example-repeat))
  343.                        3)
  344.                         (message "Congratulation!")
  345.                       (error "Three was the count!")))
  346.               "Apply Form")
  347.        (widget-insert " ")
  348.        (widget-create 'push-button
  349.               :notify (lambda (&rest ignore)
  350.                     (widget-example))
  351.               "Reset Form")
  352.        (widget-insert "\n")
  353.        (use-local-map widget-keymap)
  354.        (widget-setup))
  355.  
  356. 
  357. File: widget.info,  Node: Setting Up the Buffer,  Next: Basic Types,  Prev: Programming Example,  Up: Top
  358.  
  359. Setting Up the Buffer
  360. =====================
  361.  
  362.    Widgets are created with `widget-create', which returns a "widget"
  363. object.  This object can be queried and manipulated by other widget
  364. functions, until it is deleted with `widget-delete'.  After the widgets
  365. have been created, `widget-setup' must be called to enable them.
  366.  
  367.  - Function: widget-create TYPE [ KEYWORD ARGUMENT ]...
  368.      Create and return a widget of type TYPE.  The syntax for the TYPE
  369.      argument is described in *Note Basic Types::.
  370.  
  371.      The keyword arguments can be used to overwrite the keyword
  372.      arguments that are part of TYPE.
  373.  
  374.  - Function: widget-delete WIDGET
  375.      Delete WIDGET and remove it from the buffer.
  376.  
  377.  - Function: widget-setup
  378.      Setup a buffer to support widgets.
  379.  
  380.      This should be called after creating all the widgets and before
  381.      allowing the user to edit them.
  382.  
  383.  
  384.    If you want to insert text outside the widgets in the form, the
  385. recommended way to do that is with `widget-insert'.
  386.  
  387.  - Function: widget-insert
  388.      Insert the arguments, either strings or characters, at point.  The
  389.      inserted text will be read only.
  390.  
  391.    There is a standard widget keymap which you might find useful.
  392.  
  393.  - Const: widget-keymap
  394.      A keymap with the global keymap as its parent.
  395.      <TAB> and `C-<TAB>' are bound to `widget-forward' and
  396.      `widget-backward', respectively.  `<RET>' and `mouse-2' are bound
  397.      to `widget-button-press' and `widget-button-'.
  398.  
  399.  - Variable: widget-global-map
  400.      Keymap used by `widget-button-press' and `widget-button-click'
  401.      when not on a button.  By default this is `global-map'.
  402.  
  403. 
  404. File: widget.info,  Node: Basic Types,  Next: Sexp Types,  Prev: Setting Up the Buffer,  Up: Top
  405.  
  406. Basic Types
  407. ===========
  408.  
  409.    The syntax of a type specification is given below:
  410.  
  411.      NAME ::= (NAME [KEYWORD ARGUMENT]... ARGS)
  412.           |   NAME
  413.  
  414.    Where, NAME is a widget name, KEYWORD is the name of a property,
  415. ARGUMENT is the value of the property, and ARGS are interpreted in a
  416. widget specific way.
  417.  
  418.    There following keyword arguments that apply to all widgets:
  419.  
  420. `:value'
  421.      The initial value for widgets of this type.
  422.  
  423. `:format'
  424.      This string will be inserted in the buffer when you create a
  425.      widget.  The following `%' escapes are available:
  426.  
  427.     `%['
  428.     `%]'
  429.           The text inside will be marked as a button.
  430.  
  431.           By default, the text will be shown in `widget-button-face',
  432.           and surrounded by brackets.
  433.  
  434.            - User Option: widget-button-prefix
  435.                String to prefix buttons.
  436.  
  437.            - User Option: widget-button-suffix
  438.                String to suffix buttons.
  439.  
  440.     `%{'
  441.     `%}'
  442.           The text inside will be displayed with the face specified by
  443.           `:sample-face'.
  444.  
  445.     `%v'
  446.           This will be replaces with the buffer representation of the
  447.           widgets value.  What this is depends on the widget type.
  448.  
  449.     `%d'
  450.           Insert the string specified by `:doc' here.
  451.  
  452.     `%h'
  453.           Like `%d', with the following modifications: If the
  454.           documentation string is more than one line, it will add a
  455.           button which will toggle between showing only the first line,
  456.           and showing the full text.  Furthermore, if there is no
  457.           `:doc' property in the widget, it will instead examine the
  458.           `:documentation-property' property.  If it is a lambda
  459.           expression, it will be called with the widget's value as an
  460.           argument, and the result will be used as the documentation
  461.           text.
  462.  
  463.     `%t'
  464.           Insert the string specified by `:tag' here, or the `princ'
  465.           representation of the value if there is no tag.
  466.  
  467.     `%%'
  468.           Insert a literal `%'.
  469.  
  470. `:button-face'
  471.      Face used to highlight text inside %[ %] in the format.
  472.  
  473. `:button-prefix'
  474. `:button-suffix'
  475.      Text around %[ %] in the format.
  476.  
  477.      These can be
  478.     *nil*
  479.           No text is inserted.
  480.  
  481.     *a string*
  482.           The string is inserted literally.
  483.  
  484.     *a symbol*
  485.           The value of the symbol is expanded according to this table.
  486.  
  487. `:doc'
  488.      The string inserted by the `%d' escape in the format string.
  489.  
  490. `:tag'
  491.      The string inserted by the `%t' escape in the format string.
  492.  
  493. `:tag-glyph'
  494.      Name of image to use instead of the string specified by `:tag' on
  495.      Emacsen that supports it.
  496.  
  497. `:help-echo'
  498.      Message displayed whenever you move to the widget with either
  499.      `widget-forward' or `widget-backward'.
  500.  
  501. `:indent'
  502.      An integer indicating the absolute number of spaces to indent
  503.      children of this widget.
  504.  
  505. `:offset'
  506.      An integer indicating how many extra spaces to add to the widget's
  507.      grandchildren compared to this widget.
  508.  
  509. `:extra-offset'
  510.      An integer indicating how many extra spaces to add to the widget's
  511.      children compared to this widget.
  512.  
  513. `:notify'
  514.      A function called each time the widget or a nested widget is
  515.      changed.  The function is called with two or three arguments.  The
  516.      first argument is the widget itself, the second argument is the
  517.      widget that was changed, and the third argument is the event
  518.      leading to the change, if any.
  519.  
  520. `:menu-tag'
  521.      Tag used in the menu when the widget is used as an option in a
  522.      `menu-choice' widget.
  523.  
  524. `:menu-tag-get'
  525.      Function used for finding the tag when the widget is used as an
  526.      option in a `menu-choice' widget.  By default, the tag used will
  527.      be either the `:menu-tag' or `:tag' property if present, or the
  528.      `princ' representation of the `:value' property if not.
  529.  
  530. `:match'
  531.      Should be a function called with two arguments, the widget and a
  532.      value, and returning non-nil if the widget can represent the
  533.      specified value.
  534.  
  535. `:validate'
  536.      A function which takes a widget as an argument, and return nil if
  537.      the widgets current value is valid for the widget.  Otherwise, it
  538.      should return the widget containing the invalid data, and set that
  539.      widgets `:error' property to a string explaining the error.
  540.  
  541.      The following predefined function can be used:
  542.  
  543.       - Function: widget-children-validate WIDGET
  544.           All the `:children' of WIDGET must be valid.
  545.  
  546. `:tab-order'
  547.      Specify the order in which widgets are traversed with
  548.      `widget-forward' or `widget-backward'.  This is only partially
  549.      implemented.
  550.  
  551.        a. Widgets with tabbing order `-1' are ignored.
  552.  
  553.        b. (Unimplemented) When on a widget with tabbing order N, go to
  554.           the next widget in the buffer with tabbing order N+1 or `nil',
  555.           whichever comes first.
  556.  
  557.        c. When on a widget with no tabbing order specified, go to the
  558.           next widget in the buffer with a positive tabbing order, or
  559.           `nil'
  560.  
  561. `:parent'
  562.      The parent of a nested widget (e.g. a `menu-choice' item or an
  563.      element of a `editable-list' widget).
  564.  
  565. `:sibling-args'
  566.      This keyword is only used for members of a `radio-button-choice' or
  567.      `checklist'.  The value should be a list of extra keyword
  568.      arguments, which will be used when creating the `radio-button' or
  569.      `checkbox' associated with this item.
  570.  
  571.  - User Option: widget-glyph-directory
  572.      Directory where glyphs are found.  Widget will look here for a
  573.      file with the same name as specified for the image, with either a
  574.      `.xpm' (if supported) or `.xbm' extension.
  575.  
  576.  - User Option: widget-glyph-enable
  577.      If non-nil, allow glyphs to appear on displays where they are
  578.      supported.
  579.  
  580. * Menu:
  581.  
  582. * link::
  583. * url-link::
  584. * info-link::
  585. * push-button::
  586. * editable-field::
  587. * text::
  588. * menu-choice::
  589. * radio-button-choice::
  590. * item::
  591. * choice-item::
  592. * toggle::
  593. * checkbox::
  594. * checklist::
  595. * editable-list::
  596. * group::
  597.  
  598. 
  599. File: widget.info,  Node: link,  Next: url-link,  Prev: Basic Types,  Up: Basic Types
  600.  
  601. The `link' Widget
  602. -----------------
  603.  
  604.    Syntax:
  605.  
  606.      TYPE ::= (link [KEYWORD ARGUMENT]...  [ VALUE ])
  607.  
  608.    The VALUE, if present, is used to initialize the `:value' property.
  609. The value should be a string, which will be inserted in the buffer.
  610.  
  611.    By default the link will be shown in brackets.
  612.  
  613.  - User Option: widget-link-prefix
  614.      String to prefix links.
  615.  
  616.  - User Option: widget-link-suffix
  617.      String to suffix links.
  618.  
  619. 
  620. File: widget.info,  Node: url-link,  Next: info-link,  Prev: link,  Up: Basic Types
  621.  
  622. The `url-link' Widget
  623. ---------------------
  624.  
  625.    Syntax:
  626.  
  627.      TYPE ::= (url-link [KEYWORD ARGUMENT]...  URL)
  628.  
  629.    When this link is invoked, the WWW browser specified by
  630. `browse-url-browser-function' will be called with URL.
  631.  
  632. 
  633. File: widget.info,  Node: info-link,  Next: push-button,  Prev: url-link,  Up: Basic Types
  634.  
  635. The `info-link' Widget
  636. ----------------------
  637.  
  638.    Syntax:
  639.  
  640.      TYPE ::= (info-link [KEYWORD ARGUMENT]...  ADDRESS)
  641.  
  642.    When this link is invoked, the build-in info browser is started on
  643. ADDRESS.
  644.  
  645. 
  646. File: widget.info,  Node: push-button,  Next: editable-field,  Prev: info-link,  Up: Basic Types
  647.  
  648. The `push-button' Widget
  649. ------------------------
  650.  
  651.    Syntax:
  652.  
  653.      TYPE ::= (push-button [KEYWORD ARGUMENT]...  [ VALUE ])
  654.  
  655.    The VALUE, if present, is used to initialize the `:value' property.
  656. The value should be a string, which will be inserted in the buffer.
  657.  
  658.    By default the tag will be shown in brackets.
  659.  
  660.  - User Option: widget-push-button-prefix
  661.      String to prefix push buttons.
  662.  
  663.  - User Option: widget-push-button-suffix
  664.      String to suffix push buttons.
  665.  
  666. 
  667. File: widget.info,  Node: editable-field,  Next: text,  Prev: push-button,  Up: Basic Types
  668.  
  669. The `editable-field' Widget
  670. ---------------------------
  671.  
  672.    Syntax:
  673.  
  674.      TYPE ::= (editable-field [KEYWORD ARGUMENT]... [ VALUE ])
  675.  
  676.    The VALUE, if present, is used to initialize the `:value' property.
  677. The value should be a string, which will be inserted in field.  This
  678. widget will match all string values.
  679.  
  680.    The following extra properties are recognized.
  681.  
  682. `:size'
  683.      The width of the editable field.
  684.      By default the field will reach to the end of the line.
  685.  
  686. `:value-face'
  687.      Face used for highlighting the editable field.  Default is
  688.      `widget-field-face'.
  689.  
  690. `:secret'
  691.      Character used to display the value.  You can set this to e.g. `?*'
  692.      if the field contains a password or other secret information.  By
  693.      default, the value is not secret.
  694.  
  695. `:valid-regexp'
  696.      By default the `:validate' function will match the content of the
  697.      field with the value of this attribute.  The default value is `""'
  698.      which matches everything.
  699.  
  700. `:keymap'
  701.      Keymap used in the editable field.  The default value is
  702.      `widget-field-keymap', which allows you to use all the normal
  703.      editing commands, even if the buffers major mode suppress some of
  704.      them.  Pressing return invokes the function specified by `:action'.
  705.  
  706. 
  707. File: widget.info,  Node: text,  Next: menu-choice,  Prev: editable-field,  Up: Basic Types
  708.  
  709. The `text' Widget
  710. -----------------
  711.  
  712.    This is just like `editable-field', but intended for multiline text
  713. fields.  The default `:keymap' is `widget-text-keymap', which does not
  714. rebind the return key.
  715.  
  716. 
  717. File: widget.info,  Node: menu-choice,  Next: radio-button-choice,  Prev: text,  Up: Basic Types
  718.  
  719. The `menu-choice' Widget
  720. ------------------------
  721.  
  722.    Syntax:
  723.  
  724.      TYPE ::= (menu-choice [KEYWORD ARGUMENT]... TYPE ... )
  725.  
  726.    The TYPE arguments represents each possible choice.  The widgets
  727. value of will be the value of the chosen TYPE argument.  This widget
  728. will match any value that matches at least one of the specified TYPE
  729. arguments.
  730.  
  731. `:void'
  732.      Widget type used as a fallback when the value does not match any
  733.      of the specified TYPE arguments.
  734.  
  735. `:case-fold'
  736.      Set this to nil if you don't want to ignore case when prompting
  737.      for a choice through the minibuffer.
  738.  
  739. `:children'
  740.      A list whose car is the widget representing the currently chosen
  741.      type in the buffer.
  742.  
  743. `:choice'
  744.      The current chosen type
  745.  
  746. `:args'
  747.      The list of types.
  748.  
  749. 
  750. File: widget.info,  Node: radio-button-choice,  Next: item,  Prev: menu-choice,  Up: Basic Types
  751.  
  752. The `radio-button-choice' Widget
  753. --------------------------------
  754.  
  755.    Syntax:
  756.  
  757.      TYPE ::= (radio-button-choice [KEYWORD ARGUMENT]...  TYPE ... )
  758.  
  759.    The TYPE arguments represents each possible choice.  The widgets
  760. value of will be the value of the chosen TYPE argument.  This widget
  761. will match any value that matches at least one of the specified TYPE
  762. arguments.
  763.  
  764.    The following extra properties are recognized.
  765.  
  766. `:entry-format'
  767.      This string will be inserted for each entry in the list.  The
  768.      following `%' escapes are available:
  769.     `%v'
  770.           Replaced with the buffer representation of the TYPE widget.
  771.  
  772.     `%b'
  773.           Replace with the radio button.
  774.  
  775.     `%%'
  776.           Insert a literal `%'.
  777.  
  778. `button-args'
  779.      A list of keywords to pass to the radio buttons.  Useful for
  780.      setting e.g. the `:help-echo' for each button.
  781.  
  782. `:buttons'
  783.      The widgets representing the radio buttons.
  784.  
  785. `:children'
  786.      The widgets representing each type.
  787.  
  788. `:choice'
  789.      The current chosen type
  790.  
  791. `:args'
  792.      The list of types.
  793.  
  794.    You can add extra radio button items to a `radio-button-choice'
  795. widget after it has been created with the function
  796. `widget-radio-add-item'.
  797.  
  798.  - Function: widget-radio-add-item WIDGET TYPE
  799.      Add to `radio-button-choice' widget WIDGET a new radio button item
  800.      of type TYPE.
  801.  
  802.    Please note that such items added after the `radio-button-choice'
  803. widget has been created will *not* be properly destructed when you call
  804. `widget-delete'.
  805.  
  806. 
  807. File: widget.info,  Node: item,  Next: choice-item,  Prev: radio-button-choice,  Up: Basic Types
  808.  
  809. The `item' Widget
  810. -----------------
  811.  
  812.    Syntax:
  813.  
  814.      ITEM ::= (item [KEYWORD ARGUMENT]... VALUE)
  815.  
  816.    The VALUE, if present, is used to initialize the `:value' property.
  817. The value should be a string, which will be inserted in the buffer.
  818. This widget will only match the specified value.
  819.  
  820. 
  821. File: widget.info,  Node: choice-item,  Next: toggle,  Prev: item,  Up: Basic Types
  822.  
  823. The `choice-item' Widget
  824. ------------------------
  825.  
  826.    Syntax:
  827.  
  828.      ITEM ::= (choice-item [KEYWORD ARGUMENT]... VALUE)
  829.  
  830.    The VALUE, if present, is used to initialize the `:value' property.
  831. The value should be a string, which will be inserted in the buffer as a
  832. button.  Activating the button of a `choice-item' is equivalent to
  833. activating the parent widget.  This widget will only match the
  834. specified value.
  835.  
  836. 
  837. File: widget.info,  Node: toggle,  Next: checkbox,  Prev: choice-item,  Up: Basic Types
  838.  
  839. The `toggle' Widget
  840. -------------------
  841.  
  842.    Syntax:
  843.  
  844.      TYPE ::= (toggle [KEYWORD ARGUMENT]...)
  845.  
  846.    The widget has two possible states, `on' and `off', which
  847. corresponds to a `t' or `nil' value.
  848.  
  849.    The following extra properties are recognized.
  850.  
  851. `:on'
  852.      String representing the `on' state.  By default the string `on'.
  853.  
  854. `:off'
  855.      String representing the `off' state.  By default the string `off'.
  856.  
  857. `:on-glyph'
  858.      Name of a glyph to be used instead of the `:on' text string, on
  859.      emacsen that supports it.
  860.  
  861. `:off-glyph'
  862.      Name of a glyph to be used instead of the `:off' text string, on
  863.      emacsen that supports it.
  864.  
  865. 
  866. File: widget.info,  Node: checkbox,  Next: checklist,  Prev: toggle,  Up: Basic Types
  867.  
  868. The `checkbox' Widget
  869. ---------------------
  870.  
  871.    The widget has two possible states, `selected' and `unselected',
  872. which corresponds to a `t' or `nil' value.
  873.  
  874.    Syntax:
  875.  
  876.      TYPE ::= (checkbox [KEYWORD ARGUMENT]...)
  877.  
  878. 
  879. File: widget.info,  Node: checklist,  Next: editable-list,  Prev: checkbox,  Up: Basic Types
  880.  
  881. The `checklist' Widget
  882. ----------------------
  883.  
  884.    Syntax:
  885.  
  886.      TYPE ::= (checklist [KEYWORD ARGUMENT]...  TYPE ... )
  887.  
  888.    The TYPE arguments represents each checklist item.  The widgets
  889. value of will be a list containing the value of each ticked TYPE
  890. argument.  The checklist widget will match a list whose elements all
  891. matches at least one of the specified TYPE arguments.
  892.  
  893.    The following extra properties are recognized.
  894.  
  895. `:entry-format'
  896.      This string will be inserted for each entry in the list.  The
  897.      following `%' escapes are available:
  898.     `%v'
  899.           Replaced with the buffer representation of the TYPE widget.
  900.  
  901.     `%b'
  902.           Replace with the checkbox.
  903.  
  904.     `%%'
  905.           Insert a literal `%'.
  906.  
  907. `:greedy'
  908.      Usually, a checklist will only match if the items are in the exact
  909.      sequence given in the specification.  By setting `:greedy' to
  910.      non-nil, it will allow the items to come in any sequence.
  911.      However, if you extract the value they will be in the sequence
  912.      given in the checklist. I.e. the original sequence is forgotten.
  913.  
  914. `button-args'
  915.      A list of keywords to pass to the checkboxes.  Useful for setting
  916.      e.g. the `:help-echo' for each checkbox.
  917.  
  918. `:buttons'
  919.      The widgets representing the checkboxes.
  920.  
  921. `:children'
  922.      The widgets representing each type.
  923.  
  924. `:args'
  925.      The list of types.
  926.  
  927. 
  928. File: widget.info,  Node: editable-list,  Next: group,  Prev: checklist,  Up: Basic Types
  929.  
  930. The `editable-list' Widget
  931. --------------------------
  932.  
  933.    Syntax:
  934.  
  935.      TYPE ::= (editable-list [KEYWORD ARGUMENT]... TYPE)
  936.  
  937.    The value is a list, where each member represents one widget of type
  938. TYPE.
  939.  
  940.    The following extra properties are recognized.
  941.  
  942. `:entry-format'
  943.      This string will be inserted for each entry in the list.  The
  944.      following `%' escapes are available:
  945.     `%v'
  946.           This will be replaced with the buffer representation of the
  947.           TYPE widget.
  948.  
  949.     `%i'
  950.           Insert the [INS] button.
  951.  
  952.     `%d'
  953.           Insert the [DEL] button.
  954.  
  955.     `%%'
  956.           Insert a literal `%'.
  957.  
  958. `:insert-button-args'
  959.      A list of keyword arguments to pass to the insert buttons.
  960.  
  961. `:delete-button-args'
  962.      A list of keyword arguments to pass to the delete buttons.
  963.  
  964. `:append-button-args'
  965.      A list of keyword arguments to pass to the trailing insert button.
  966.  
  967. `:buttons'
  968.      The widgets representing the insert and delete buttons.
  969.  
  970. `:children'
  971.      The widgets representing the elements of the list.
  972.  
  973. `:args'
  974.      List whose car is the type of the list elements.
  975.  
  976. 
  977. File: widget.info,  Node: group,  Prev: editable-list,  Up: Basic Types
  978.  
  979. The `group' Widget
  980. ------------------
  981.  
  982.    This widget simply group other widget together.
  983.  
  984.    Syntax:
  985.  
  986.      TYPE ::= (group [KEYWORD ARGUMENT]... TYPE...)
  987.  
  988.    The value is a list, with one member for each TYPE.
  989.  
  990. 
  991. File: widget.info,  Node: Sexp Types,  Next: Widget Properties,  Prev: Basic Types,  Up: Top
  992.  
  993. Sexp Types
  994. ==========
  995.  
  996.    A number of widgets for editing s-expressions (lisp types) are also
  997. available.  These basically fall in the following categories.
  998.  
  999. * Menu:
  1000.  
  1001. * constants::
  1002. * generic::
  1003. * atoms::
  1004. * composite::
  1005.  
  1006. 
  1007. File: widget.info,  Node: constants,  Next: generic,  Prev: Sexp Types,  Up: Sexp Types
  1008.  
  1009. The Constant Widgets.
  1010. ---------------------
  1011.  
  1012.    The `const' widget can contain any lisp expression, but the user is
  1013. prohibited from editing edit it, which is mainly useful as a component
  1014. of one of the composite widgets.
  1015.  
  1016.    The syntax for the `const' widget is
  1017.  
  1018.      TYPE ::= (const [KEYWORD ARGUMENT]...  [ VALUE ])
  1019.  
  1020.    The VALUE, if present, is used to initialize the `:value' property
  1021. and can be any s-expression.
  1022.  
  1023.  - Widget: const
  1024.      This will display any valid s-expression in an immutable part of
  1025.      the buffer.
  1026.  
  1027.    There are two variations of the `const' widget, namely
  1028. `variable-item' and `function-item'.  These should contain a symbol
  1029. with a variable or function binding.  The major difference from the
  1030. `const' widget is that they will allow the user to see the variable or
  1031. function documentation for the symbol.
  1032.  
  1033.  - Widget: variable-item
  1034.      An immutable symbol that is bound as a variable.
  1035.  
  1036.  - Widget: function-item
  1037.      An immutable symbol that is bound as a function.
  1038.  
  1039. 
  1040. File: widget.info,  Node: generic,  Next: atoms,  Prev: constants,  Up: Sexp Types
  1041.  
  1042. Generic Sexp Widget.
  1043. --------------------
  1044.  
  1045.    The `sexp' widget can contain any lisp expression, and allows the
  1046. user to edit it inline in the buffer.
  1047.  
  1048.    The syntax for the `sexp' widget is
  1049.  
  1050.      TYPE ::= (sexp [KEYWORD ARGUMENT]...  [ VALUE ])
  1051.  
  1052.  - Widget: sexp
  1053.      This will allow you to edit any valid s-expression in an editable
  1054.      buffer field.
  1055.  
  1056.      The `sexp' widget takes the same keyword arguments as the
  1057.      `editable-field' widget.
  1058.  
  1059. 
  1060. File: widget.info,  Node: atoms,  Next: composite,  Prev: generic,  Up: Sexp Types
  1061.  
  1062. Atomic Sexp Widgets.
  1063. --------------------
  1064.  
  1065.    The atoms are s-expressions that does not consist of other
  1066. s-expressions.  A string is an atom, while a list is a composite type.
  1067. You can edit the value of an atom with the following widgets.
  1068.  
  1069.    The syntax for all the atoms are
  1070.  
  1071.      TYPE ::= (NAME [KEYWORD ARGUMENT]...  [ VALUE ])
  1072.  
  1073.    The VALUE, if present, is used to initialize the `:value' property
  1074. and must be an expression of the same type as the widget.  I.e. the
  1075. string widget can only be initialized with a string.
  1076.  
  1077.    All the atom widgets take the same keyword arguments as the
  1078. `editable-field' widget.
  1079.  
  1080.  - Widget: string
  1081.      Allows you to edit a string in an editable field.
  1082.  
  1083.  - Widget: regexp
  1084.      Allows you to edit a regular expression in an editable field.
  1085.  
  1086.  - Widget: character
  1087.      Allows you to enter a character in an editable field.
  1088.  
  1089.  - Widget: file
  1090.      Allows you to edit a file name in an editable field.  If you invoke
  1091.      the tag button, you can edit the file name in the mini-buffer with
  1092.      completion.
  1093.  
  1094.      Keywords:
  1095.     `:must-match'
  1096.           If this is set to non-nil, only existing file names will be
  1097.           allowed in the minibuffer.
  1098.  
  1099.  - Widget: directory
  1100.      Allows you to edit a directory name in an editable field.  Similar
  1101.      to the `file' widget.
  1102.  
  1103.  - Widget: symbol
  1104.      Allows you to edit a lisp symbol in an editable field.
  1105.  
  1106.  - Widget: function
  1107.      Allows you to edit a lambda expression, or a function name with
  1108.      completion.
  1109.  
  1110.  - Widget: variable
  1111.      Allows you to edit a variable name, with completion.
  1112.  
  1113.  - Widget: integer
  1114.      Allows you to edit an integer in an editable field.
  1115.  
  1116.  - Widget: number
  1117.      Allows you to edit a number in an editable field.
  1118.  
  1119.  - Widget: boolean
  1120.      Allows you to edit a boolean.  In lisp this means a variable which
  1121.      is either nil meaning false, or non-nil meaning true.
  1122.  
  1123. 
  1124. File: widget.info,  Node: composite,  Prev: atoms,  Up: Sexp Types
  1125.  
  1126. Composite Sexp Widgets.
  1127. -----------------------
  1128.  
  1129.    The syntax for the composite are
  1130.  
  1131.      TYPE ::= (NAME [KEYWORD ARGUMENT]...  COMPONENT...)
  1132.  
  1133.    Where each COMPONENT must be a widget type.  Each component widget
  1134. will be displayed in the buffer, and be editable to the user.
  1135.  
  1136.  - Widget: cons
  1137.      The value of a `cons' widget is a cons-cell where the car is the
  1138.      value of the first component and the cdr is the value of the second
  1139.      component.  There must be exactly two components.
  1140.  
  1141.  - Widget: list
  1142.      The value of a `list' widget is a list containing the value of
  1143.      each of its component.
  1144.  
  1145.  - Widget: vector
  1146.      The value of a `vector' widget is a vector containing the value of
  1147.      each of its component.
  1148.  
  1149.    The above suffice for specifying fixed size lists and vectors.  To
  1150. get variable length lists and vectors, you can use a `choice', `set' or
  1151. `repeat' widgets together with the `:inline' keywords.  If any
  1152. component of a composite widget has the `:inline' keyword set, its
  1153. value must be a list which will then be spliced into the composite.
  1154. For example, to specify a list whose first element must be a file name,
  1155. and whose remaining arguments should either by the symbol `t' or two
  1156. files, you can use the following widget specification:
  1157.  
  1158.      (list file
  1159.            (choice (const t)
  1160.                    (list :inline t
  1161.                          :value ("foo" "bar")
  1162.                          string string)))
  1163.  
  1164.    The value of a widget of this type will either have the form `(file
  1165. t)' or `(file string string)'.
  1166.  
  1167.    This concept of inline is probably hard to understand.  It was
  1168. certainly hard to implement so instead of confuse you more by trying to
  1169. explain it here, I'll just suggest you meditate over it for a while.
  1170.  
  1171.  - Widget: choice
  1172.      Allows you to edit a sexp which may have one of fixed set of
  1173.      types.  It is currently implemented with the `choice-menu' basic
  1174.      widget, and has a similar syntax.
  1175.  
  1176.  - Widget: set
  1177.      Allows you to specify a type which must be a list whose elements
  1178.      all belong to given set.  The elements of the list is not
  1179.      significant.  This is implemented on top of the `checklist' basic
  1180.      widget, and has a similar syntax.
  1181.  
  1182.  - Widget: repeat
  1183.      Allows you to specify a variable length list whose members are all
  1184.      of the same type.  Implemented on top of the `editable-list' basic
  1185.      widget, and has a similar syntax.
  1186.  
  1187. 
  1188. File: widget.info,  Node: Widget Properties,  Next: Defining New Widgets,  Prev: Sexp Types,  Up: Top
  1189.  
  1190. Properties
  1191. ==========
  1192.  
  1193.    You can examine or set the value of a widget by using the widget
  1194. object that was returned by `widget-create'.
  1195.  
  1196.  - Function: widget-value WIDGET
  1197.      Return the current value contained in WIDGET.  It is an error to
  1198.      call this function on an uninitialized widget.
  1199.  
  1200.  - Function: widget-value-set WIDGET VALUE
  1201.      Set the value contained in WIDGET to VALUE.  It is an error to
  1202.      call this function with an invalid VALUE.
  1203.  
  1204.    *Important:* You *must* call `widget-setup' after modifying the
  1205. value of a widget before the user is allowed to edit the widget again.
  1206. It is enough to call `widget-setup' once if you modify multiple
  1207. widgets.  This is currently only necessary if the widget contains an
  1208. editing field, but may be necessary for other widgets in the future.
  1209.  
  1210.    If your application needs to associate some information with the
  1211. widget objects, for example a reference to the item being edited, it
  1212. can be done with `widget-put' and `widget-get'.  The property names
  1213. must begin with a `:'.
  1214.  
  1215.  - Function: widget-put WIDGET PROPERTY VALUE
  1216.      In WIDGET set PROPERTY to VALUE.  PROPERTY should be a symbol,
  1217.      while VALUE can be anything.
  1218.  
  1219.  - Function: widget-get WIDGET PROPERTY
  1220.      In WIDGET return the value for PROPERTY.  PROPERTY should be a
  1221.      symbol, the value is what was last set by `widget-put' for
  1222.      PROPERTY.
  1223.  
  1224.  - Function: widget-member WIDGET PROPERTY
  1225.      Non-nil if WIDGET has a value (even nil) for property PROPERTY.
  1226.  
  1227.    Occasionally it can be useful to know which kind of widget you have,
  1228. i.e. the name of the widget type you gave when the widget was created.
  1229.  
  1230.  - Function: widget-type WIDGET
  1231.      Return the name of WIDGET, a symbol.
  1232.  
  1233.    Widgets can be in two states: active, which means they are
  1234. modifiable by the user, or inactive, which means they cannot be
  1235. modified by the user.  You can query or set the state with the
  1236. following code:
  1237.  
  1238.      ;; Examine if WIDGET is active or not.
  1239.      (if (widget-apply WIDGET :active)
  1240.          (message "Widget is active.")
  1241.        (message "Widget is inactive.")
  1242.      
  1243.      ;; Make WIDGET inactive.
  1244.      (widget-apply WIDGET :deactivate)
  1245.      
  1246.      ;; Make WIDGET active.
  1247.      (widget-apply WIDGET :activate)
  1248.  
  1249.    A widget is inactive if itself, or any of its ancestors (found by
  1250. following the `:parent' link) have been deactivated.  To make sure a
  1251. widget is really active, you must therefore activate both itself, and
  1252. all its ancestors.
  1253.  
  1254.      (while widget
  1255.        (widget-apply widget :activate)
  1256.        (setq widget (widget-get widget :parent)))
  1257.  
  1258.    You can check if a widget has been made inactive by examining the
  1259. value of `:inactive' keyword.  If this is non-nil, the widget itself has
  1260. been deactivated.  This is different from using the `:active' keyword,
  1261. in that the later tell you if the widget *or* any of its ancestors have
  1262. been deactivated.   Do not attempt to set the `:inactive' keyword
  1263. directly.  Use the `:activate' `:deactivated' keywords instead.
  1264.  
  1265. 
  1266. File: widget.info,  Node: Defining New Widgets,  Next: Widget Browser,  Prev: Widget Properties,  Up: Top
  1267.  
  1268. Defining New Widgets
  1269. ====================
  1270.  
  1271.    You can define specialized widgets with `define-widget'.  It allows
  1272. you to create a shorthand for more complex widgets, including specifying
  1273. component widgets and default new default values for the keyword
  1274. arguments.
  1275.  
  1276.  - Function: widget-define NAME CLASS DOC &rest ARGS
  1277.      Define a new widget type named NAME from `class'.
  1278.  
  1279.      NAME and class should both be symbols, `class' should be one of
  1280.      the existing widget types.
  1281.  
  1282.      The third argument DOC is a documentation string for the widget.
  1283.  
  1284.      After the new widget has been defined, the following two calls will
  1285.      create identical widgets:
  1286.  
  1287.         *      (widget-create NAME)
  1288.  
  1289.         *      (apply widget-create CLASS ARGS)
  1290.  
  1291.  
  1292.    Using `widget-define' does just store the definition of the widget
  1293. type in the `widget-type' property of NAME, which is what
  1294. `widget-create' uses.
  1295.  
  1296.    If you just want to specify defaults for keywords with no complex
  1297. conversions, you can use `identity' as your conversion function.
  1298.  
  1299.    The following additional keyword arguments are useful when defining
  1300. new widgets:
  1301. `:convert-widget'
  1302.      Function to convert a widget type before creating a widget of that
  1303.      type.  It takes a widget type as an argument, and returns the
  1304.      converted widget type.  When a widget is created, this function is
  1305.      called for the widget type and all the widgets parent types, most
  1306.      derived first.
  1307.  
  1308.      The following predefined functions can be used here:
  1309.  
  1310.       - Function: widget-types-convert-widget WIDGET
  1311.           Convert `:args' as widget types in WIDGET.
  1312.  
  1313.       - Function: widget-value-convert-widget WIDGET
  1314.           Initialize `:value' from `:args' in WIDGET.
  1315.  
  1316. `:value-to-internal'
  1317.      Function to convert the value to the internal format.  The function
  1318.      takes two arguments, a widget and an external value, and returns
  1319.      the internal value.  The function is called on the present `:value'
  1320.      when the widget is created, and on any value set later with
  1321.      `widget-value-set'.
  1322.  
  1323. `:value-to-external'
  1324.      Function to convert the value to the external format.  The function
  1325.      takes two arguments, a widget and an internal value, and returns
  1326.      the internal value.  The function is called on the present `:value'
  1327.      when the widget is created, and on any value set later with
  1328.      `widget-value-set'.
  1329.  
  1330. `:create'
  1331.      Function to create a widget from scratch.  The function takes one
  1332.      argument, a widget type, and create a widget of that type, insert
  1333.      it in the buffer, and return a widget object.
  1334.  
  1335. `:delete'
  1336.      Function to delete a widget.  The function takes one argument, a
  1337.      widget, and should remove all traces of the widget from the buffer.
  1338.  
  1339. `:value-create'
  1340.      Function to expand the `%v' escape in the format string.  It will
  1341.      be called with the widget as its argument.  Should insert a
  1342.      representation of the widgets value in the buffer.
  1343.  
  1344. `:value-delete'
  1345.      Should remove the representation of the widgets value from the
  1346.      buffer.  It will be called with the widget as its argument.  It
  1347.      doesn't have to remove the text, but it should release markers and
  1348.      delete nested widgets if such has been used.
  1349.  
  1350.      The following predefined function can be used here:
  1351.  
  1352.       - Function: widget-children-value-delete WIDGET
  1353.           Delete all `:children' and `:buttons' in WIDGET.
  1354.  
  1355. `:value-get'
  1356.      Function to extract the value of a widget, as it is displayed in
  1357.      the buffer.
  1358.  
  1359.      The following predefined function can be used here:
  1360.  
  1361.       - Function: widget-value-value-get WIDGET
  1362.           Return the `:value' property of WIDGET.
  1363.  
  1364. `:format-handler'
  1365.      Function to handle unknown `%' escapes in the format string.  It
  1366.      will be called with the widget and the escape character as
  1367.      arguments.  You can set this to allow your widget to handle
  1368.      non-standard escapes.
  1369.  
  1370.      You should end up calling `widget-default-format-handler' to handle
  1371.      unknown escape sequences, which will handle the `%h' and any future
  1372.      escape sequences, as well as give an error for unknown escapes.
  1373.  
  1374. `:action'
  1375.      Function to handle user initiated events.  By default, `:notify'
  1376.      the parent.
  1377.  
  1378.      The following predefined function can be used here:
  1379.  
  1380.       - Function: widget-parent-action WIDGET &optional EVENT
  1381.           Tell `:parent' of WIDGET to handle the `:action'.
  1382.           Optional EVENT is the event that triggered the action.
  1383.  
  1384. `:prompt-value'
  1385.      Function to prompt for a value in the minibuffer.  The function
  1386.      should take four arguments, WIDGET, PROMPT, VALUE, and UNBOUND and
  1387.      should return a value for widget entered by the user.  PROMPT is
  1388.      the prompt to use.  VALUE is the default value to use, unless
  1389.      UNBOUND is non-nil in which case there are no default value.  The
  1390.      function should read the value using the method most natural for
  1391.      this widget, and does not have to check that it matches.
  1392.  
  1393.    If you want to define a new widget from scratch, use the `default'
  1394. widget as its base.
  1395.  
  1396.  - Widget: default
  1397.      Widget used as a base for other widgets.
  1398.  
  1399.      It provides most of the functionality that is referred to as "by
  1400.      default" in this text.
  1401.  
  1402. 
  1403. File: widget.info,  Node: Widget Browser,  Next: Widget Minor Mode,  Prev: Defining New Widgets,  Up: Top
  1404.  
  1405. Widget Browser
  1406. ==============
  1407.  
  1408.    There is a separate package to browse widgets.  This is intended to
  1409. help programmers who want to examine the content of a widget.  The
  1410. browser shows the value of each keyword, but uses links for certain
  1411. keywords such as `:parent', which avoids printing cyclic structures.
  1412.  
  1413.  - Command: widget-browse WIDGET
  1414.      Create a widget browser for WIDGET.  When called interactively,
  1415.      prompt for WIDGET.
  1416.  
  1417.  - Command: widget-browse-other-window WIDGET
  1418.      Create a widget browser for WIDGET and show it in another window.
  1419.      When called interactively, prompt for WIDGET.
  1420.  
  1421.  - Command: widget-browse-at POS
  1422.      Create a widget browser for the widget at POS.  When called
  1423.      interactively, use the position of point.
  1424.  
  1425. 
  1426. File: widget.info,  Node: Widget Minor Mode,  Next: Utilities,  Prev: Widget Browser,  Up: Top
  1427.  
  1428. Widget Minor Mode
  1429. =================
  1430.  
  1431.    There is a minor mode for manipulating widgets in major modes that
  1432. doesn't provide any support for widgets themselves.  This is mostly
  1433. intended to be useful for programmers doing experiments.
  1434.  
  1435.  - Command: widget-minor-mode
  1436.      Toggle minor mode for traversing widgets.  With arg, turn widget
  1437.      mode on if and only if arg is positive.
  1438.  
  1439.  - Variable: widget-minor-mode-keymap
  1440.      Keymap used in `widget-minor-mode'.
  1441.  
  1442. 
  1443. File: widget.info,  Node: Utilities,  Next: Widget Wishlist,  Prev: Widget Minor Mode,  Up: Top
  1444.  
  1445. Utilities.
  1446. ==========
  1447.  
  1448.  - Function: widget-prompt-value WIDGET PROMPT [ VALUE UNBOUND ]
  1449.      Prompt for a value matching WIDGET, using PROMPT.
  1450.      The current value is assumed to be VALUE, unless UNBOUND is
  1451.      non-nil.
  1452.  
  1453.  - Function: widget-get-sibling WIDGET
  1454.      Get the item WIDGET is assumed to toggle.
  1455.      This is only meaningful for radio buttons or checkboxes in a list.
  1456.  
  1457. 
  1458. File: widget.info,  Node: Widget Wishlist,  Prev: Utilities,  Up: Top
  1459.  
  1460. Wishlist
  1461. ========
  1462.  
  1463.    * It should be possible to add or remove items from a list with `C-k'
  1464.      and `C-o' (suggested by RMS).
  1465.  
  1466.    * The `[INS]' and `[DEL]' buttons should be replaced by a single
  1467.      dash (`-').  The dash should be a button that, when invoked, ask
  1468.      whether you want to add or delete an item (RMS wanted to git rid of
  1469.      the ugly buttons, the dash is my idea).
  1470.  
  1471.    * The `menu-choice' tag should be prettier, something like the
  1472.      abbreviated menus in Open Look.
  1473.  
  1474.    * Finish `:tab-order'.
  1475.  
  1476.    * Make indentation work with glyphs and proportional fonts.
  1477.  
  1478.    * Add commands to show overview of object and class hierarchies to
  1479.      the browser.
  1480.  
  1481.    * Find a way to disable mouse highlight for inactive widgets.
  1482.  
  1483.    * Find a way to make glyphs look inactive.
  1484.  
  1485.    * Add `property-list' widget.
  1486.  
  1487.    * Add `association-list' widget.
  1488.  
  1489.    * Add `key-binding' widget.
  1490.  
  1491.    * Add `widget' widget for editing widget specifications.
  1492.  
  1493.    * Find clean way to implement variable length list.  See
  1494.      `TeX-printer-list' for an explanation.
  1495.  
  1496.    * `C-h' in `widget-prompt-value' should give type specific help.
  1497.  
  1498.    * A mailto widget.
  1499.  
  1500.    * `C-e e' in a fixed size field should go to the end of the text in
  1501.      the field, not the end of the field itself.
  1502.  
  1503.    * Use and overlay instead of markers to delimit the widget.  Create
  1504.      accessors for the end points.
  1505.  
  1506.    * Clicking on documentation links should call `describe-function' or
  1507.      `widget-browse-other-window' and friends directly, instead of going
  1508.      through `apropos'.  If more than one function is valid for the
  1509.      symbol, it should pop up a menu.
  1510.  
  1511.  
  1512. 
  1513. Tag Table:
  1514. Node: Top107
  1515. Node: Introduction487
  1516. Node: User Interface3970
  1517. Node: Programming Example8865
  1518. Node: Setting Up the Buffer12182
  1519. Node: Basic Types13899
  1520. Node: link19944
  1521. Node: url-link20458
  1522. Node: info-link20770
  1523. Node: push-button21061
  1524. Node: editable-field21634
  1525. Node: text22973
  1526. Node: menu-choice23271
  1527. Node: radio-button-choice24136
  1528. Node: item25715
  1529. Node: choice-item26103
  1530. Node: toggle26601
  1531. Node: checkbox27326
  1532. Node: checklist27632
  1533. Node: editable-list29076
  1534. Node: group30258
  1535. Node: Sexp Types30545
  1536. Node: constants30858
  1537. Node: generic31937
  1538. Node: atoms32470
  1539. Node: composite34417
  1540. Node: Widget Properties36883
  1541. Node: Defining New Widgets39946
  1542. Node: Widget Browser45246
  1543. Node: Widget Minor Mode46104
  1544. Node: Utilities46661
  1545. Node: Widget Wishlist47142
  1546. 
  1547. End Tag Table
  1548.